package com.jinsilu.freight.ui.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jinsilu.freight.R;
import com.jinsilu.freight.http.response.WaybillBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class FinishedWaybillAdapter extends BaseQuickAdapter<WaybillBean, BaseViewHolder> {

    public FinishedWaybillAdapter(@Nullable List<WaybillBean> data) {
        super(R.layout.item_waybill_finished, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, WaybillBean bean) {
        holder.setText(R.id.item_waybill_company_name, String.format("运单号：%s", bean.getWaybillNumber()))
                .setText(R.id.item_waybill_address, String.format("%s", bean.getLineName()))
                .setText(R.id.item_waybill_goods_name, bean.getGoodsName())
                .setText(R.id.item_waybill_money_name, String.format("%s元/吨", bean.getSettlePrice()))
                .setText(R.id.item_waybill_load_number, String.format("%s吨", TextUtils.isEmpty(bean.getUploadWeight()) ? "0.00" : bean.getUploadWeight()))
                .setText(R.id.item_waybill_unloading_number, String.format("%s吨", TextUtils.isEmpty(bean.getUnloadWeight()) ? "0.00" : bean.getUnloadWeight()))
                .setText(R.id.item_waybill_allow_loss, String.format("允许亏吨：%s吨", bean.getLossWeight()))
                .setText(R.id.item_waybill_grab_date, String.format("抢单时间：%s", bean.getGrabTime()));
//                .setText(R.id.item_waybill_remark, String.format("备注：%s", TextUtils.isEmpty(bean.getRemarks()) ? "无" : TextUtils.isEmpty(bean.getRemarks().trim()) ? "无" : bean.getRemarks()));


//        holder.setText(R.id.tv_bill_of_lading_num, String.format("提货单号：%s", bean.getPCreditCode()));
//
//        if (bean.getWStatus() == 1) {
//            holder.setText(R.id.tv_receiving_account_info, String.format("结算收款账户信息：%s/%s/%s", bean.getOnlinePayName(), bean.getOnlinePayBankName(), bean.getOnlinePayAccount()));
//        } else {
//            holder.setText(R.id.tv_receiving_account_info, String.format("结算收款账户信息：%s/%s/%s", bean.getDrReciverName(), bean.getDrCardBank(), bean.getDrReciverCardNo()));
//        }
//        holder.setText(R.id.tv_prepayment_amount, String.format("预付金额：%s", bean.getPrepayMoney()));
//        if (bean.getOpenAccountState() == 1)
//            holder.setText(R.id.tv_prepayment_account_info, String.format("预付收款账户信息：%s/%s/%s", bean.getPrepayName(), bean.getPrepayBankName(), bean.getPrepayBankAccount()));
//        if (bean.getPrepayState() == 1) {
//            holder.setText(R.id.tv_prepayment_status, String.format("预付状态：%s", "支付成功"));
//        } else if (bean.getPrepayState() == 2) {
//            holder.setText(R.id.tv_prepayment_status, String.format("预付状态：%s", "未支付"));
//        } else {
//            holder.setText(R.id.tv_prepayment_status, String.format("预付状态：%s", "支付失败"));
//        }

        holder.setText(R.id.item_waybill_status_one, "已支付(3个工作日左右到账)")
                .setBackgroundResource(R.id.item_waybill_status_one, R.drawable.waybill_blue_bg_ic)
                .setText(R.id.item_waybill_upload_unloading, "24小时客服")
                .setGone(R.id.item_waybill_upload_unloading, false);
    }
}
